﻿using System;
using System.Collections.Generic;
using System.Linq;

namespace FAQFrameworks
{
    public class RequiredValid
    {
        public string Message { get; set; }

        public RequiredValid()
        {
            this.Continue = false;
        }

        public object Value { get; set; }

        public bool Continue { get; set; }

        public RequiredValid(string message)
        {
            this.Message = message;
        }

        public void ValidateHandler
            (object sender, ValidateEventArgs e)
        {
            string str = Value as string;
            e.Continue = this.Continue;
            if (string.IsNullOrEmpty(str))
            {                
                e.IsValid = false;
                e.Messsge = this.Message;
            }
        }
    }    
}
